package com.margo.project.client;


import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

/**
 * 	CXF提供Client调用WebService接口的方法
 * CXF异常:No operation was found with the name
 * https://blog.csdn.net/qq_18675693/article/details/52134805
 * @author fangxingbang
 *	wsimport -s generate http://localhost:8080/webservice/margoservice?wsdl
 */
public class CXFClient2 {
	public static void main(String[] args) throws Exception {
//		JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();  
//        Client client = clientFactory.createClient("http://localhost:8080/webservice/margoservice?wsdl",
//        		new QName("http://margoservice.webservice.project.margo.com/", "MargoWebService"));  
//        Object[] result = client.invoke("hello", "KEVIN");  
//        System.out.println(result[0]);  	
        
		JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();  
        Client client = clientFactory.createClient("http://localhost:13201/webservice/fxbservice?wsdl");  
        Object[] result = client.invoke("fxbHello", "KEVIN");  
        System.out.println(result[0]);  
	}
}
